package com.enlorenz.common.geo.map.base;

public abstract class AbstractTileFilePathCreator implements ITileFilePathCreator{
	public final static String FILE_SPLITOR="\\";
	
	public String createTilePath(String dir,String name){
		return dir+FILE_SPLITOR+name;
	}
	/**
	 * 创建文件夹目录
	 * @param baseFilePath
	 * @param gtw
	 * @return
	 */
	public String createTileDirPath(String baseFilePath,TileWrapper gtw){
		return baseFilePath+FILE_SPLITOR+gtw.getZoom()+FILE_SPLITOR+gtw.getXtile();
	}
	
	public FileWrapper createWrapper(String baseFilePath,TileWrapper gtw){
		//文件夹
		String dir=createTileDirPath(baseFilePath,gtw);
		//文件名
		String fileName=createTileFileName(gtw);
		//全路径
		String fullPath=createTilePath(dir, fileName);
		FileWrapper fw=new FileWrapper();
		fw.setDir(dir);
		fw.setFileName(fileName);
		fw.setFullPath(fullPath);
		return fw;
	}
	/**
	 * 创建
	 * @param gtw
	 * @return
	 */
	protected abstract  String createTileFileName(TileWrapper gtw);
}
